package com.yociyy.admin.biz;

import com.yociyy.admin.mapper.BaseLogMapper;
import com.yociyy.admin.model.entity.BaseLog;
import com.yociyy.common.utils.EntityHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 日志信息 Biz
 *
 * @author Y.yang
 * @date 2019-12-12
 */
@Service
public class BaseLogBiz {

	@Autowired
	private BaseLogMapper baseLogMapper;

	/**
	 * 查询日志信息分页列表
	 */
	public List<BaseLog> selectPage(Map<String, Object> params) {
		return baseLogMapper.selectPage(params);
	}

	/**
	 * 查询日志信息通过id
	 */
	public BaseLog selectLogById(Long id) {
		return baseLogMapper.selectByPrimaryKey(id);
	}

	/**
	 * 新增日志信息
	 */
	public void insertLog(BaseLog baseLog) {
		EntityHelper.assembleCrtFields(baseLog);
		baseLogMapper.insertSelective(baseLog);
	}

	/**
	 * 修改日志信息
	 */
	public void updateLog(BaseLog baseLog) {
		EntityHelper.assembleUpdFields(baseLog);
		baseLogMapper.updateByPrimaryKeySelective(baseLog);
	}

	/**
	 * 删除日志信息
	 */
	public int deleteLogByIds(long[] ids) {
		return baseLogMapper.deletePostByIds(ids);
	}
}
